// page/destination/destination.js
const api = require('../../utils/api.js');

Page({
    data: {
		pos:[],
		attractions:[]
    },
    onLoad: function(options) {
		let self = this;
        let id = options.id;
        let typ = options.typ;
        let name = options.name;
		api.destination.place(typ, id,(state,res) => {
			if(state === 'success'){
				let pos = res.data;
				// console.log(pos);
				self.setData({
					pos
				});

				let data = {};
				api.destination.attractions(typ,id,'',data,(state,res) => {
					if(state === 'success'){
						let attractions = res.data.items;
						// console.log(attractions);
						self.setData({
							attractions
						});
					}
				})
			}
		})
    }
})